//
//  YHPickerViewController.h
//  TallyBook
//
//  Created by 林宁宁 on 16/9/11.
//  Copyright © 2016年 林宁宁. All rights reserved.
//

#import "YHPopBaseView.h"
#import "YHConstant.h"
#import "YHBaseObject.h"

NS_ASSUME_NONNULL_BEGIN

/**
 *  时间日期选择模式
 */
typedef NS_ENUM(NSInteger, YHPickerDateType) {
    YHPickerDateType_Custom           = 0,  //  自定义选择 要去设置  dataList
    
    YHPickerDateType_Year             = 1 << 0, //  年
    YHPickerDateType_Month            = 1 << 1, //  月
    YHPickerDateType_Day              = 1 << 2, //  日
    YHPickerDateType_Hour             = 1 << 3, //  时
    YHPickerDateType_Minute           = 1 << 4, //  分
    YHPickerDateType_Second           = 1 << 5, //  秒
    
    YHPickerDateType_Minute30         = 1 << 6, //  分 30分一个间隔
    YHPickerDateType_MonthDayWeek     = 1 << 10, // 显示月日周
};


typedef NS_ENUM(NSInteger, YHPickerDateSelectAble){
    YHPickerDateSelectAble_all,     //过去未来都可选
    YHPickerDateSelectAble_future,  //只能选未来的时间
    YHPickerDateSelectAble_old      //只能选过去的时间
};

@interface YHPickerConfig : YHBaseObject


/** 时间选择的模式 */
@property (assign, nonatomic) YHPickerDateType pickerMode;

/** 点击完成之后  YHPickerItem 类型*/
@property (strong, nonatomic) void(^pickerFinishBlock)(id selectItems);

/// 滑动选择改变了
@property (strong, nonatomic) NSString * (^pickerDidChangeBlock)(NSString * passTitle);

/// 选择器的标题
@property (copy, nonatomic) NSString * pickerHeadTitle;

/// 时间格式
@property (copy, nonatomic) NSString * dateFormat;


/*******************  时间选择模式  *******************/

/** 初始定位的日期 */
@property (retain, nonatomic) NSDate * dateOrigin;

/** 可选时间的类型 过去-未来-无限制*/
@property (assign, nonatomic) YHPickerDateSelectAble picker_able;

/// 显示是否选择今天
@property (assign, nonatomic) BOOL showTodayPicker;
@property (copy, nonatomic) void(^barRightBtnConfig)(UIButton * sender);
@property (copy, nonatomic) void(^barRightBtnAction)(void);

/// 显示日期中文标识
@property (assign, nonatomic) BOOL showDateCN;

@end


@interface YHPickerViewController : YHPopBaseView


/// 选择时间
+ (void)showPickerDateType:(YHPickerDateType)dateType
                originDate:(NSDate * _Nullable)originDate
                    format:(NSString * _Nullable)format
          didiChangePicker:(NSString *(^_Nullable)(NSString * currentTitle))hintBlock
                    finish:(void(^_Nullable)(NSDate * passDate))finish;
+ (void)showPickerDateType:(YHPickerDateType)dateType
                originDate:(NSDate * _Nullable)originDate
                    format:(NSString * _Nullable)format
          didiChangePicker:(NSString *(^_Nullable)(NSString * currentTitle))hintBlock
                    finish:(void(^_Nullable)(NSDate * passDate))finish
                    config:(void(^_Nullable)(YHPickerConfig * passConfig))config;
/// 选择时间
/// @param dateType 时间类型
/// @param ableType 未来 过去时间是否可选
/// @param showToday 显示重置今天的按钮
/// @param originDate 初始时间
/// @param title 标题
/// @param showDateCN 日期中文显示标识
/// @param hintBlock 有设置就会显示顶部的提示标题 滑动选择变化之后 顶部的标题更新
+ (void)showPickerDateType:(YHPickerDateType)dateType
                  dateAble:(YHPickerDateSelectAble)ableType
            showResetToday:(BOOL)showToday
                originDate:(NSDate * _Nullable)originDate
                     title:(NSString * _Nullable)title
                showDateCN:(BOOL)showDateCN
                    format:(NSString * _Nullable)format
          didiChangePicker:(NSString *(^_Nullable)(NSString * currentTitle))hintBlock
                    finish:(void(^_Nullable)(NSDate * passDate))finish
                    config:(void(^_Nullable)(YHPickerConfig * passConfig))config;;

/// 选择一个字符串数组 或者 人数之类
/// @param dataList 数据
/// @param hintBlock 有设置就会显示顶部的提示标题 滑动选择变化之后 顶部的标题更新
+ (void)showPickerStringList:(NSArray <NSString *> *)dataList
                       title:(NSString * _Nullable)title
                originSelect:(NSString * _Nullable)selecttitle
            didiChangePicker:(NSString *(^_Nullable)(NSString * currentTitle))hintBlock
                      finish:(void(^_Nullable)(NSString * pickerTitle))finish;
+ (void)showPickerStringList:(NSArray <NSString *> *)dataList
                       title:(NSString * _Nullable)title
                originSelect:(NSString * _Nullable)selecttitle
            didiChangePicker:(NSString *(^_Nullable)(NSString * currentTitle))hintBlock
                      finish:(void(^_Nullable)(NSString * pickerTitle))finish
                      config:(void(^_Nullable)(YHPickerConfig * passConfig))config;



@end

NS_ASSUME_NONNULL_END

